package com.sys.text;

import com.sys.entity.Supplier;
import com.sys.mapper.SupplierMapper;
import com.sys.utils.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.List;

public class SupplierTest {
    @Test
    public void test1(){
        SqlSession sqlSession = MyBatisUtil.createSqlSession();
        int count = sqlSession.getMapper(SupplierMapper.class).count();
        System.out.println(count);
        MyBatisUtil.closeSqlSession(sqlSession);
    }
    @Test
    public void test2(){
        SqlSession sqlSession = MyBatisUtil.createSqlSession();
        List<Supplier> list = sqlSession.getMapper(SupplierMapper.class).list();
        list.forEach(supplier -> {
            System.out.println(supplier.getSupName());
        });
        MyBatisUtil.closeSqlSession(sqlSession);
    }
}
